<?php

namespace App\Http\Controllers\OpenShop\Feishu;

use App\Http\Controllers\BaseController;
use App\Service\OpenShop\Feishu\SendSmsService;
use App\Service\OpenShop\User\RmsUserService;
use Illuminate\Http\Request;

class SendSmsController extends BaseController
{
    public function signing(Request $request)
    {
        $orderNo = $request->post('orderNo', '');
        $smsType = $request->post('smsType', SendSmsService::SMS_TYPE_APP);
        $userInfo = getRmsUserInfoByAuth();

        $data = (new SendSmsService($orderNo))->sendSmsBySign($userInfo, $smsType);
        if (!mb_strlen($data)) {
            return $this->fail(3, '短信发送失败:不符合发送条件');
        }
        return $this->success();
    }
}
